function ngBindHtmlDirective($sce) {
  return {
    restrict: 'A',
    link: function link(scope, element, attrs) {
      scope.$watch(attrs.ngBindHtml, function handleChange(value) {
        if (value !== undefined && value !== null) {
          element.html($sce.trustAsHtml(value));
        }
      });
    }
  };
}

ngBindHtmlDirective.$inject = ['$sce'];

export default ngBindHtmlDirective;
